<?php
header("content-type:text/html;charset=utf-8");
$dsn="mysql:host=127.0.0.1;dbname=test;charset=utf8";
$pdo=new PDO($dsn,'root','root');
$id=$_POST['id'];
$name=$_POST['name'];
$shijian=$_POST['time'];
$number=$_POST['number'];
$class=$_POST['classname'];

$sql="update class set name='$name'time='$shijian',number='$number',classname='$class' WHERE id='$id'";
$res=$pdo->exec($sql);
if($res){
    echo"<script>alert('修改成功');location.href='show.php'</script>";
}else{
    echo"<script>alert('修改失败');location.href='show.php'</script>";
}





?>